package com.netease.a.a;

import android.os.Environment;
import com.netease.framework.m;
import com.netease.j.f;
import com.netease.k.c;
import com.netease.pris.a.u;
import com.netease.pris.c.i;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.DateFormat;
import java.text.DateFormatSymbols;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;

public final class e
{
  static final String a = "if-modified-since";
  static final String b = "if-none-match";
  public static final String c = "content-type";
  public static final String d = "content-encoding";
  public static final String e = "expires";
  public static final String f = "cache-control";
  public static final String g = "last-modified";
  public static final String h = "etag";
  private static final int i = 4096;
  private static final boolean j = true;
  private static final int k = 104857600;
  private static final int l = 268435456;
  private static final int m = 104857600;
  private static final int n = 52428800;
  private static final String o = "CacheManagerEx";
  private static final int p = 3145728;
  private static final String q = "no-store";
  private static final String r = "no-cache";
  private static final String s = "max-age";
  private static SimpleDateFormat t = null;
  private static String u = Environment.getExternalStorageDirectory().toString() + "/" + "pris" + "/cache";
  private static String v = Environment.getDataDirectory() + "/data/" + "com.netease.pris" + "/cache";
  private static String w = Environment.getExternalStorageDirectory().toString() + "/" + "pris" + "/offcache";
  private static String x = Environment.getDataDirectory() + "/data/" + "com.netease.pris" + "/offcache";
  private static HashMap y = new HashMap();

  static
  {
    a();
  }

  private static int a(InputStream paramInputStream, OutputStream paramOutputStream, int paramInt, f paramf)
  {
    int i4;
    if (paramInt > 0)
    {
      byte[] arrayOfByte2 = new byte[4096];
      int i6 = 0;
      i4 = 0;
      while ((i4 < paramInt) && (!paramf.a()))
      {
        int i7 = paramInputStream.read(arrayOfByte2, i6, Math.min(arrayOfByte2.length - i6, paramInt - i4));
        i6 += i7;
        if (i7 == -1)
          throw new IOException("http readData from stream num mismatch");
        if (i6 == 4096)
        {
          paramOutputStream.write(arrayOfByte2, 0, 4096);
          i4 += i7;
          i6 = 0;
          continue;
        }
        i4 += i7;
      }
      if (paramf.a())
        throw new IOException("http closed");
      if (i6 > 0)
        paramOutputStream.write(arrayOfByte2, 0, i6);
      return i4;
    }
    long l1 = System.currentTimeMillis();
    byte[] arrayOfByte1 = new byte[4096];
    int i1 = 0;
    int i2 = 0;
    int i3 = 0;
    label177: long l2;
    if (!paramf.a())
    {
      i3 = paramInputStream.read(arrayOfByte1, i1, arrayOfByte1.length - i1);
      l2 = System.currentTimeMillis();
      if (i3 < 0)
        i4 = i3;
    }
    while (true)
    {
      if (i1 > 0)
        paramOutputStream.write(arrayOfByte1, 0, i1);
      if (!paramf.a())
        break;
      throw new IOException("http closed");
      if (i3 == 0)
      {
        if (l2 - l1 <= 5000L)
          break label177;
        i4 = i3;
        continue;
      }
      i2 += i3;
      int i5 = i1 + i3;
      if (i5 == 4096)
      {
        paramOutputStream.write(arrayOfByte1, 0, 4096);
        i5 = 0;
      }
      i1 = i5;
      l1 = l2;
      break label177;
      i4 = i3;
    }
  }

  // ERROR //
  public static g a(com.netease.framework.a.m paramm, org.apache.http.HttpResponse paramHttpResponse, InputStream paramInputStream, int paramInt, f paramf)
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore 5
    //   3: invokestatic 163	java/lang/System:currentTimeMillis	()J
    //   6: lstore 6
    //   8: aload_0
    //   9: invokevirtual 170	com/netease/framework/a/m:v	()Ljava/lang/String;
    //   12: astore 8
    //   14: aload_1
    //   15: ifnull +8 -> 23
    //   18: aload 8
    //   20: ifnonnull +6 -> 26
    //   23: aload 5
    //   25: areturn
    //   26: aload_1
    //   27: ldc 17
    //   29: invokeinterface 176 2 0
    //   34: ifnonnull +94 -> 128
    //   37: aconst_null
    //   38: astore 9
    //   40: aload_0
    //   41: invokevirtual 178	com/netease/framework/a/m:x	()Z
    //   44: ifne +174 -> 218
    //   47: aload_1
    //   48: ldc 20
    //   50: invokeinterface 176 2 0
    //   55: ifnonnull +91 -> 146
    //   58: aconst_null
    //   59: astore 28
    //   61: aload_1
    //   62: ldc 26
    //   64: invokeinterface 176 2 0
    //   69: ifnonnull +95 -> 164
    //   72: aconst_null
    //   73: astore 29
    //   75: aload_1
    //   76: ldc 29
    //   78: invokeinterface 176 2 0
    //   83: ifnonnull +99 -> 182
    //   86: aconst_null
    //   87: astore 30
    //   89: aload_1
    //   90: ldc 23
    //   92: invokeinterface 176 2 0
    //   97: ifnonnull +103 -> 200
    //   100: aconst_null
    //   101: astore 31
    //   103: aload 28
    //   105: aload 29
    //   107: aload 30
    //   109: aload 31
    //   111: invokestatic 181	com/netease/a/a/e:a	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lcom/netease/a/a/g;
    //   114: astore 10
    //   116: aload 10
    //   118: ifnonnull +112 -> 230
    //   121: aload 10
    //   123: astore 5
    //   125: goto -102 -> 23
    //   128: aload_1
    //   129: ldc 17
    //   131: invokeinterface 176 2 0
    //   136: invokeinterface 186 1 0
    //   141: astore 9
    //   143: goto -103 -> 40
    //   146: aload_1
    //   147: ldc 20
    //   149: invokeinterface 176 2 0
    //   154: invokeinterface 186 1 0
    //   159: astore 28
    //   161: goto -100 -> 61
    //   164: aload_1
    //   165: ldc 26
    //   167: invokeinterface 176 2 0
    //   172: invokeinterface 186 1 0
    //   177: astore 29
    //   179: goto -104 -> 75
    //   182: aload_1
    //   183: ldc 29
    //   185: invokeinterface 176 2 0
    //   190: invokeinterface 186 1 0
    //   195: astore 30
    //   197: goto -108 -> 89
    //   200: aload_1
    //   201: ldc 23
    //   203: invokeinterface 176 2 0
    //   208: invokeinterface 186 1 0
    //   213: astore 31
    //   215: goto -112 -> 103
    //   218: new 188	com/netease/a/a/g
    //   221: dup
    //   222: invokespecial 189	com/netease/a/a/g:<init>	()V
    //   225: astore 10
    //   227: goto -111 -> 116
    //   230: aload 8
    //   232: aload 10
    //   234: aload_0
    //   235: invokevirtual 192	com/netease/framework/a/m:A	()Z
    //   238: invokestatic 195	com/netease/a/a/e:a	(Ljava/lang/String;Lcom/netease/a/a/g;Z)V
    //   241: getstatic 199	com/netease/pris/app/e:d	Z
    //   244: ifeq +414 -> 658
    //   247: ldc 201
    //   249: new 70	java/lang/StringBuilder
    //   252: dup
    //   253: invokespecial 73	java/lang/StringBuilder:<init>	()V
    //   256: ldc 203
    //   258: invokevirtual 89	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   261: invokestatic 163	java/lang/System:currentTimeMillis	()J
    //   264: lload 6
    //   266: lsub
    //   267: invokevirtual 206	java/lang/StringBuilder:append	(J)Ljava/lang/StringBuilder;
    //   270: invokevirtual 96	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   273: invokestatic 211	com/netease/g/b:d	(Ljava/lang/String;Ljava/lang/String;)V
    //   276: invokestatic 163	java/lang/System:currentTimeMillis	()J
    //   279: lstore 11
    //   281: new 81	java/io/File
    //   284: dup
    //   285: aload 10
    //   287: invokevirtual 213	com/netease/a/a/g:e	()Ljava/lang/String;
    //   290: invokespecial 214	java/io/File:<init>	(Ljava/lang/String;)V
    //   293: astore 13
    //   295: aload 13
    //   297: invokevirtual 217	java/io/File:exists	()Z
    //   300: ifne +11 -> 311
    //   303: aload 10
    //   305: invokestatic 220	com/netease/a/a/e:a	(Lcom/netease/a/a/g;)V
    //   308: goto -285 -> 23
    //   311: getstatic 199	com/netease/pris/app/e:d	Z
    //   314: ifeq +37 -> 351
    //   317: ldc 201
    //   319: new 70	java/lang/StringBuilder
    //   322: dup
    //   323: invokespecial 73	java/lang/StringBuilder:<init>	()V
    //   326: ldc 222
    //   328: invokevirtual 89	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   331: invokestatic 163	java/lang/System:currentTimeMillis	()J
    //   334: lload 11
    //   336: lsub
    //   337: invokevirtual 206	java/lang/StringBuilder:append	(J)Ljava/lang/StringBuilder;
    //   340: invokevirtual 96	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   343: invokestatic 211	com/netease/g/b:d	(Ljava/lang/String;Ljava/lang/String;)V
    //   346: invokestatic 163	java/lang/System:currentTimeMillis	()J
    //   349: lstore 11
    //   351: aload 10
    //   353: aload 9
    //   355: invokevirtual 224	com/netease/a/a/g:b	(Ljava/lang/String;)V
    //   358: aload_2
    //   359: ifnull +223 -> 582
    //   362: iload_3
    //   363: i2l
    //   364: lstore 16
    //   366: lload 16
    //   368: invokestatic 227	com/netease/a/a/e:a	(J)Z
    //   371: ifne +50 -> 421
    //   374: new 229	com/netease/a/a/d
    //   377: dup
    //   378: invokespecial 230	com/netease/a/a/d:<init>	()V
    //   381: athrow
    //   382: astore 21
    //   384: aconst_null
    //   385: astore 19
    //   387: aload 21
    //   389: invokevirtual 233	java/io/IOException:printStackTrace	()V
    //   392: aload 19
    //   394: ifnull +8 -> 402
    //   397: aload 19
    //   399: invokevirtual 236	java/io/OutputStream:close	()V
    //   402: aload 13
    //   404: invokestatic 239	com/netease/a/a/e:c	(Ljava/io/File;)V
    //   407: aload 13
    //   409: invokestatic 242	com/netease/a/a/e:a	(Ljava/io/File;)Z
    //   412: pop
    //   413: aload 10
    //   415: invokestatic 220	com/netease/a/a/e:a	(Lcom/netease/a/a/g;)V
    //   418: goto -395 -> 23
    //   421: getstatic 199	com/netease/pris/app/e:d	Z
    //   424: ifeq +227 -> 651
    //   427: ldc 201
    //   429: new 70	java/lang/StringBuilder
    //   432: dup
    //   433: invokespecial 73	java/lang/StringBuilder:<init>	()V
    //   436: ldc 244
    //   438: invokevirtual 89	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   441: invokestatic 163	java/lang/System:currentTimeMillis	()J
    //   444: lload 11
    //   446: lsub
    //   447: invokevirtual 206	java/lang/StringBuilder:append	(J)Ljava/lang/StringBuilder;
    //   450: invokevirtual 96	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   453: invokestatic 211	com/netease/g/b:d	(Ljava/lang/String;Ljava/lang/String;)V
    //   456: invokestatic 163	java/lang/System:currentTimeMillis	()J
    //   459: lstore 23
    //   461: new 246	java/io/FileOutputStream
    //   464: dup
    //   465: aload 13
    //   467: invokespecial 248	java/io/FileOutputStream:<init>	(Ljava/io/File;)V
    //   470: astore 19
    //   472: aload_0
    //   473: invokevirtual 250	com/netease/framework/a/m:y	()Z
    //   476: ifeq +24 -> 500
    //   479: ldc 252
    //   481: aload 9
    //   483: invokevirtual 258	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   486: ifne +14 -> 500
    //   489: new 260	java/util/zip/GZIPOutputStream
    //   492: dup
    //   493: aload 19
    //   495: invokespecial 263	java/util/zip/GZIPOutputStream:<init>	(Ljava/io/OutputStream;)V
    //   498: astore 19
    //   500: aload 19
    //   502: ifnull +18 -> 520
    //   505: aload 10
    //   507: aload_2
    //   508: aload 19
    //   510: iload_3
    //   511: aload 4
    //   513: invokestatic 265	com/netease/a/a/e:a	(Ljava/io/InputStream;Ljava/io/OutputStream;ILcom/netease/j/f;)I
    //   516: i2l
    //   517: invokevirtual 268	com/netease/a/a/g:b	(J)V
    //   520: getstatic 199	com/netease/pris/app/e:d	Z
    //   523: ifeq +37 -> 560
    //   526: ldc 201
    //   528: new 70	java/lang/StringBuilder
    //   531: dup
    //   532: invokespecial 73	java/lang/StringBuilder:<init>	()V
    //   535: ldc_w 270
    //   538: invokevirtual 89	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   541: invokestatic 163	java/lang/System:currentTimeMillis	()J
    //   544: lload 23
    //   546: lsub
    //   547: invokevirtual 206	java/lang/StringBuilder:append	(J)Ljava/lang/StringBuilder;
    //   550: invokevirtual 96	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   553: invokestatic 211	com/netease/g/b:d	(Ljava/lang/String;Ljava/lang/String;)V
    //   556: invokestatic 163	java/lang/System:currentTimeMillis	()J
    //   559: pop2
    //   560: aload 19
    //   562: ifnull +8 -> 570
    //   565: aload 19
    //   567: invokevirtual 236	java/io/OutputStream:close	()V
    //   570: aload 13
    //   572: invokestatic 239	com/netease/a/a/e:c	(Ljava/io/File;)V
    //   575: aload 10
    //   577: astore 5
    //   579: goto -556 -> 23
    //   582: iconst_0
    //   583: ifeq +7 -> 590
    //   586: aconst_null
    //   587: invokevirtual 236	java/io/OutputStream:close	()V
    //   590: aload 13
    //   592: invokestatic 239	com/netease/a/a/e:c	(Ljava/io/File;)V
    //   595: goto -188 -> 407
    //   598: astore 18
    //   600: aconst_null
    //   601: astore 19
    //   603: aload 19
    //   605: ifnull +8 -> 613
    //   608: aload 19
    //   610: invokevirtual 236	java/io/OutputStream:close	()V
    //   613: aload 13
    //   615: invokestatic 239	com/netease/a/a/e:c	(Ljava/io/File;)V
    //   618: aload 18
    //   620: athrow
    //   621: astore 25
    //   623: goto -53 -> 570
    //   626: astore 15
    //   628: goto -38 -> 590
    //   631: astore 22
    //   633: goto -231 -> 402
    //   636: astore 20
    //   638: goto -25 -> 613
    //   641: astore 18
    //   643: goto -40 -> 603
    //   646: astore 21
    //   648: goto -261 -> 387
    //   651: lload 11
    //   653: lstore 23
    //   655: goto -194 -> 461
    //   658: lload 6
    //   660: lstore 11
    //   662: goto -381 -> 281
    //
    // Exception table:
    //   from	to	target	type
    //   366	382	382	java/io/IOException
    //   421	472	382	java/io/IOException
    //   366	382	598	finally
    //   421	472	598	finally
    //   565	570	621	java/io/IOException
    //   586	590	626	java/io/IOException
    //   397	402	631	java/io/IOException
    //   608	613	636	java/io/IOException
    //   387	392	641	finally
    //   472	560	641	finally
    //   472	560	646	java/io/IOException
  }

  private static g a(String paramString1, String paramString2, String paramString3, String paramString4)
  {
    g localg1 = new g();
    localg1.c(-1L);
    localg1.d(paramString1);
    if (com.netease.pris.app.e.d)
      com.netease.g.b.e("CacheManagerEx", "expiresString is:" + localg1.g());
    label104: String[] arrayOfString;
    int i1;
    if (paramString2 != null)
    {
      localg1.e(paramString2);
      if (paramString3 != null)
        localg1.c(paramString3);
      if (localg1.g() != null)
      {
        if (localg1.g().length() > 2)
          break label164;
        localg1.c(0L);
      }
      if (paramString4 == null)
        break label428;
      arrayOfString = paramString4.toLowerCase().split("[ ,;]");
      i1 = 0;
      if (i1 >= arrayOfString.length)
        break label428;
      if (!"no-store".equals(arrayOfString[i1]))
        break label231;
    }
    label164: label428: for (g localg2 = null; ; localg2 = localg1)
    {
      while (true)
      {
        return localg2;
        localg1.e(b(System.currentTimeMillis()));
        break;
        try
        {
          localg1.c(n().parse(localg1.g()).getTime());
        }
        catch (ParseException localParseException)
        {
          localParseException.printStackTrace();
        }
      }
      if (!com.netease.pris.app.e.d)
        break label104;
      com.netease.g.b.d("CacheManagerEx", "illegal expires: " + localg1.g());
      break label104;
      label231: if ("no-cache".equals(arrayOfString[i1]))
        localg1.c(0L);
      while (true)
      {
        i1++;
        break;
        if (!arrayOfString[i1].startsWith("max-age"))
          continue;
        int i2 = arrayOfString[i1].indexOf('=');
        if (i2 < 0)
          i2 = arrayOfString[i1].indexOf(':');
        if (i2 <= 0)
          continue;
        String str = arrayOfString[i1].substring(i2 + 1);
        try
        {
          long l1 = Long.parseLong(str);
          if (l1 < 0L)
            continue;
          localg1.c(System.currentTimeMillis() + l1 * 1000L);
        }
        catch (NumberFormatException localNumberFormatException)
        {
          if ("1d".equals(str))
          {
            localg1.c(86400000L + System.currentTimeMillis());
            continue;
          }
          if (com.netease.pris.app.e.d)
            com.netease.g.b.d("CacheManagerEx", "exception in parseHeaders for max-age:" + arrayOfString[i1].substring(i2 + 1));
          localg1.c(0L);
        }
      }
    }
  }

  public static g a(String paramString1, String paramString2, boolean paramBoolean)
  {
    return a(paramString1, paramString2, paramBoolean, true);
  }

  public static g a(String paramString1, String paramString2, boolean paramBoolean1, boolean paramBoolean2)
  {
    Object localObject = null;
    if (paramString2 == null);
    while (true)
    {
      return localObject;
      long l1 = System.currentTimeMillis();
      g localg = i.a(com.netease.b.a.d.h().a(), paramString1, paramString2);
      if (localg != null)
      {
        if (localg.d() == 0L)
        {
          a(localg);
          if (!com.netease.pris.app.e.d)
            continue;
          com.netease.g.b.d("cache get ", "cache get > " + (System.currentTimeMillis() - l1));
          continue;
        }
        File localFile1 = new File(localg.e());
        if (!localFile1.exists())
        {
          a(localg);
          if (!com.netease.pris.app.e.d)
            continue;
          com.netease.g.b.d("cache get ", "cache get > " + (System.currentTimeMillis() - l1));
          continue;
        }
        if (paramBoolean2)
        {
          if ((paramBoolean1) && (!localg.c()))
          {
            File localFile2 = new File(g());
            if (!localFile2.exists())
              localFile2.mkdirs();
            File localFile3 = new File(localFile2, localFile1.getName());
            if (a(localFile1, localFile3))
            {
              localg.a(localFile3.getPath());
              localg.a(true);
              i.a(com.netease.b.a.d.h().a(), paramString2, localg);
              m.a().a(null, localg);
              localObject = localg;
              continue;
            }
          }
          m.a().a(paramString2, localg);
        }
        if (com.netease.pris.app.e.d)
          com.netease.g.b.d("cache get ", "cache get > " + (System.currentTimeMillis() - l1));
        localObject = localg;
        continue;
      }
      if (!com.netease.pris.app.e.d)
        continue;
      com.netease.g.b.d("cache get ", "cache get > " + (System.currentTimeMillis() - l1));
    }
  }

  public static String a(String paramString, boolean paramBoolean)
  {
    long l1 = System.currentTimeMillis();
    String str1;
    if (paramBoolean)
    {
      File localFile1 = new File(g(), paramString);
      if (localFile1.exists())
      {
        String str2 = localFile1.getPath();
        m.a().a(paramString, str2);
        if (com.netease.pris.app.e.d)
          com.netease.g.b.d("getLocalFile", " local time > " + (System.currentTimeMillis() - l1));
        str1 = localFile1.getPath();
      }
    }
    while (true)
    {
      return str1;
      File localFile2 = new File(f(), paramString);
      if (localFile2.exists())
      {
        str1 = f() + "/" + paramString;
        localFile2.renameTo(new File(str1));
        m.a().a(paramString, str1);
        if (!com.netease.pris.app.e.d)
          continue;
        com.netease.g.b.d("getLocalFile", " local time > " + (System.currentTimeMillis() - l1));
        continue;
        File localFile3 = new File(f(), paramString);
        if (localFile3.exists())
        {
          String str4 = localFile3.getPath();
          m.a().a(paramString, str4);
          if (com.netease.pris.app.e.d)
            com.netease.g.b.d("getLocalFile", " local time > " + (System.currentTimeMillis() - l1));
          str1 = localFile3.getPath();
          continue;
        }
        if (com.netease.pris.app.e.d)
          com.netease.g.b.d("getLocalFile", " local time internal 1 > " + (System.currentTimeMillis() - l1));
        File localFile4 = new File(g(), paramString);
        if (localFile4.exists())
        {
          String str3 = localFile4.getPath();
          m.a().a(paramString, str3);
          if (com.netease.pris.app.e.d)
            com.netease.g.b.d("getLocalFile", " local time > " + (System.currentTimeMillis() - l1));
          str1 = localFile4.getPath();
          continue;
        }
        if (com.netease.pris.app.e.d)
          com.netease.g.b.d("getLocalFile", " local time internal 2 > " + (System.currentTimeMillis() - l1));
      }
      if (com.netease.pris.app.e.d)
        com.netease.g.b.d("getLocalFile", " local time > " + (System.currentTimeMillis() - l1));
      str1 = null;
    }
  }

  public static void a()
  {
    if (y.isEmpty())
    {
      b localb = new b();
      a(u, 104857600, localb);
      a(v, 104857600, localb);
      long l1 = com.netease.pris.b.a.b(104857600L);
      a(w, 268435456, l1, localb);
      a(x, 268435456, l1, localb);
    }
    if (com.netease.pris.a.e.a())
    {
      File localFile1 = new File(u);
      if ((!localFile1.exists()) && (!localFile1.mkdirs()))
        com.netease.g.b.f("CacheManagerEx", "Unable to create cache directory");
    }
    while (true)
    {
      return;
      File localFile2 = new File(v);
      if ((localFile2.exists()) || (localFile2.mkdirs()))
        continue;
      com.netease.g.b.f("CacheManagerEx", "Unable to create cache directory");
    }
  }

  public static void a(g paramg)
  {
    if (paramg == null);
    while (true)
    {
      return;
      if (paramg.e() != null)
        a(new File(paramg.e()));
      i.b(com.netease.b.a.d.h().a(), com.netease.b.a.d.h().c(), paramg);
      paramg.n();
    }
  }

  // ERROR //
  public static void a(com.netease.framework.a.m paramm, com.netease.framework.a.j paramj, InputStream paramInputStream, int paramInt, boolean paramBoolean, f paramf)
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore 6
    //   3: aload_1
    //   4: invokevirtual 462	com/netease/framework/a/j:d	()Lorg/apache/http/HttpResponse;
    //   7: astore 7
    //   9: aload_1
    //   10: invokevirtual 465	com/netease/framework/a/j:b	()Lcom/netease/a/a/g;
    //   13: astore 8
    //   15: aload_0
    //   16: invokevirtual 170	com/netease/framework/a/m:v	()Ljava/lang/String;
    //   19: astore 9
    //   21: aload 7
    //   23: ifnull +8 -> 31
    //   26: aload 9
    //   28: ifnonnull +4 -> 32
    //   31: return
    //   32: aload 8
    //   34: ifnonnull +32 -> 66
    //   37: aload_0
    //   38: aload 7
    //   40: aload_2
    //   41: iload_3
    //   42: aload 5
    //   44: invokestatic 467	com/netease/a/a/e:a	(Lcom/netease/framework/a/m;Lorg/apache/http/HttpResponse;Ljava/io/InputStream;ILcom/netease/j/f;)Lcom/netease/a/a/g;
    //   47: astore 27
    //   49: aload_0
    //   50: invokevirtual 178	com/netease/framework/a/m:x	()Z
    //   53: ifne -22 -> 31
    //   56: aload 9
    //   58: aload 27
    //   60: invokestatic 468	com/netease/a/a/e:a	(Ljava/lang/String;Lcom/netease/a/a/g;)V
    //   63: goto -32 -> 31
    //   66: aload 7
    //   68: ldc 20
    //   70: invokeinterface 176 2 0
    //   75: ifnonnull +92 -> 167
    //   78: aconst_null
    //   79: astore 10
    //   81: aload 7
    //   83: ldc 26
    //   85: invokeinterface 176 2 0
    //   90: ifnonnull +96 -> 186
    //   93: aconst_null
    //   94: astore 11
    //   96: aload 7
    //   98: ldc 29
    //   100: invokeinterface 176 2 0
    //   105: ifnonnull +100 -> 205
    //   108: aconst_null
    //   109: astore 12
    //   111: aload 7
    //   113: ldc 23
    //   115: invokeinterface 176 2 0
    //   120: ifnonnull +104 -> 224
    //   123: aconst_null
    //   124: astore 13
    //   126: aload 7
    //   128: ldc 17
    //   130: invokeinterface 176 2 0
    //   135: ifnonnull +108 -> 243
    //   138: aconst_null
    //   139: astore 14
    //   141: aload 10
    //   143: aload 11
    //   145: aload 12
    //   147: aload 13
    //   149: invokestatic 181	com/netease/a/a/e:a	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lcom/netease/a/a/g;
    //   152: astore 15
    //   154: aload 15
    //   156: ifnonnull +106 -> 262
    //   159: aload 8
    //   161: invokestatic 220	com/netease/a/a/e:a	(Lcom/netease/a/a/g;)V
    //   164: goto -133 -> 31
    //   167: aload 7
    //   169: ldc 20
    //   171: invokeinterface 176 2 0
    //   176: invokeinterface 186 1 0
    //   181: astore 10
    //   183: goto -102 -> 81
    //   186: aload 7
    //   188: ldc 26
    //   190: invokeinterface 176 2 0
    //   195: invokeinterface 186 1 0
    //   200: astore 11
    //   202: goto -106 -> 96
    //   205: aload 7
    //   207: ldc 29
    //   209: invokeinterface 176 2 0
    //   214: invokeinterface 186 1 0
    //   219: astore 12
    //   221: goto -110 -> 111
    //   224: aload 7
    //   226: ldc 23
    //   228: invokeinterface 176 2 0
    //   233: invokeinterface 186 1 0
    //   238: astore 13
    //   240: goto -114 -> 126
    //   243: aload 7
    //   245: ldc 17
    //   247: invokeinterface 176 2 0
    //   252: invokeinterface 186 1 0
    //   257: astore 14
    //   259: goto -118 -> 141
    //   262: aload 12
    //   264: invokestatic 473	android/text/TextUtils:isEmpty	(Ljava/lang/CharSequence;)Z
    //   267: ifne +13 -> 280
    //   270: aload 8
    //   272: aload 15
    //   274: invokevirtual 475	com/netease/a/a/g:i	()Ljava/lang/String;
    //   277: invokevirtual 290	com/netease/a/a/g:c	(Ljava/lang/String;)V
    //   280: aload 13
    //   282: invokestatic 473	android/text/TextUtils:isEmpty	(Ljava/lang/CharSequence;)Z
    //   285: ifeq +11 -> 296
    //   288: aload 10
    //   290: invokestatic 473	android/text/TextUtils:isEmpty	(Ljava/lang/CharSequence;)Z
    //   293: ifne +13 -> 306
    //   296: aload 8
    //   298: aload 15
    //   300: invokevirtual 477	com/netease/a/a/g:f	()J
    //   303: invokevirtual 278	com/netease/a/a/g:c	(J)V
    //   306: aload 10
    //   308: invokestatic 473	android/text/TextUtils:isEmpty	(Ljava/lang/CharSequence;)Z
    //   311: ifne +13 -> 324
    //   314: aload 8
    //   316: aload 15
    //   318: invokevirtual 284	com/netease/a/a/g:g	()Ljava/lang/String;
    //   321: invokevirtual 280	com/netease/a/a/g:d	(Ljava/lang/String;)V
    //   324: aload 11
    //   326: invokestatic 473	android/text/TextUtils:isEmpty	(Ljava/lang/CharSequence;)Z
    //   329: ifne +13 -> 342
    //   332: aload 8
    //   334: aload 15
    //   336: invokevirtual 479	com/netease/a/a/g:h	()Ljava/lang/String;
    //   339: invokevirtual 288	com/netease/a/a/g:e	(Ljava/lang/String;)V
    //   342: aload 15
    //   344: invokevirtual 456	com/netease/a/a/g:n	()V
    //   347: iload 4
    //   349: ifeq +295 -> 644
    //   352: aload 8
    //   354: aload 14
    //   356: invokevirtual 224	com/netease/a/a/g:b	(Ljava/lang/String;)V
    //   359: aload 9
    //   361: aload 8
    //   363: aload 8
    //   365: invokevirtual 374	com/netease/a/a/g:c	()Z
    //   368: invokestatic 195	com/netease/a/a/e:a	(Ljava/lang/String;Lcom/netease/a/a/g;Z)V
    //   371: aload 8
    //   373: invokevirtual 213	com/netease/a/a/g:e	()Ljava/lang/String;
    //   376: ifnull -345 -> 31
    //   379: new 81	java/io/File
    //   382: dup
    //   383: aload 8
    //   385: invokevirtual 213	com/netease/a/a/g:e	()Ljava/lang/String;
    //   388: invokespecial 214	java/io/File:<init>	(Ljava/lang/String;)V
    //   391: astore 16
    //   393: aload_2
    //   394: ifnull +192 -> 586
    //   397: iload_3
    //   398: i2l
    //   399: lstore 18
    //   401: lload 18
    //   403: invokestatic 227	com/netease/a/a/e:a	(J)Z
    //   406: ifne +51 -> 457
    //   409: new 229	com/netease/a/a/d
    //   412: dup
    //   413: invokespecial 230	com/netease/a/a/d:<init>	()V
    //   416: athrow
    //   417: astore 22
    //   419: aload 22
    //   421: invokevirtual 233	java/io/IOException:printStackTrace	()V
    //   424: aload 6
    //   426: ifnull +8 -> 434
    //   429: aload 6
    //   431: invokevirtual 236	java/io/OutputStream:close	()V
    //   434: new 81	java/io/File
    //   437: dup
    //   438: aload 8
    //   440: invokevirtual 213	com/netease/a/a/g:e	()Ljava/lang/String;
    //   443: invokespecial 214	java/io/File:<init>	(Ljava/lang/String;)V
    //   446: invokestatic 239	com/netease/a/a/e:c	(Ljava/io/File;)V
    //   449: aload 8
    //   451: invokestatic 220	com/netease/a/a/e:a	(Lcom/netease/a/a/g;)V
    //   454: goto -423 -> 31
    //   457: aload 16
    //   459: invokevirtual 217	java/io/File:exists	()Z
    //   462: ifeq +43 -> 505
    //   465: new 246	java/io/FileOutputStream
    //   468: dup
    //   469: aload 16
    //   471: iconst_0
    //   472: invokespecial 482	java/io/FileOutputStream:<init>	(Ljava/io/File;Z)V
    //   475: astore 24
    //   477: aload_0
    //   478: invokevirtual 250	com/netease/framework/a/m:y	()Z
    //   481: ifeq +218 -> 699
    //   484: ldc 252
    //   486: aload 14
    //   488: invokevirtual 258	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   491: ifne +208 -> 699
    //   494: new 260	java/util/zip/GZIPOutputStream
    //   497: dup
    //   498: aload 24
    //   500: invokespecial 263	java/util/zip/GZIPOutputStream:<init>	(Ljava/io/OutputStream;)V
    //   503: astore 6
    //   505: aload 6
    //   507: ifnull +79 -> 586
    //   510: aload 8
    //   512: aload_2
    //   513: aload 6
    //   515: iload_3
    //   516: aload 5
    //   518: invokestatic 265	com/netease/a/a/e:a	(Ljava/io/InputStream;Ljava/io/OutputStream;ILcom/netease/j/f;)I
    //   521: i2l
    //   522: invokevirtual 268	com/netease/a/a/g:b	(J)V
    //   525: invokestatic 163	java/lang/System:currentTimeMillis	()J
    //   528: lstore 25
    //   530: invokestatic 358	com/netease/b/a/d:h	()Lcom/netease/b/a/d;
    //   533: invokevirtual 361	com/netease/b/a/d:a	()Landroid/content/Context;
    //   536: invokestatic 358	com/netease/b/a/d:h	()Lcom/netease/b/a/d;
    //   539: invokevirtual 452	com/netease/b/a/d:c	()Ljava/lang/String;
    //   542: aload 9
    //   544: aload 8
    //   546: invokestatic 485	com/netease/pris/c/i:a	(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Lcom/netease/a/a/g;)V
    //   549: getstatic 199	com/netease/pris/app/e:d	Z
    //   552: ifeq +34 -> 586
    //   555: ldc_w 487
    //   558: new 70	java/lang/StringBuilder
    //   561: dup
    //   562: invokespecial 73	java/lang/StringBuilder:<init>	()V
    //   565: ldc_w 489
    //   568: invokevirtual 89	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   571: invokestatic 163	java/lang/System:currentTimeMillis	()J
    //   574: lload 25
    //   576: lsub
    //   577: invokevirtual 206	java/lang/StringBuilder:append	(J)Ljava/lang/StringBuilder;
    //   580: invokevirtual 96	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   583: invokestatic 211	com/netease/g/b:d	(Ljava/lang/String;Ljava/lang/String;)V
    //   586: aload 6
    //   588: ifnull +8 -> 596
    //   591: aload 6
    //   593: invokevirtual 236	java/io/OutputStream:close	()V
    //   596: new 81	java/io/File
    //   599: dup
    //   600: aload 8
    //   602: invokevirtual 213	com/netease/a/a/g:e	()Ljava/lang/String;
    //   605: invokespecial 214	java/io/File:<init>	(Ljava/lang/String;)V
    //   608: invokestatic 239	com/netease/a/a/e:c	(Ljava/io/File;)V
    //   611: goto -580 -> 31
    //   614: astore 20
    //   616: aload 6
    //   618: ifnull +8 -> 626
    //   621: aload 6
    //   623: invokevirtual 236	java/io/OutputStream:close	()V
    //   626: new 81	java/io/File
    //   629: dup
    //   630: aload 8
    //   632: invokevirtual 213	com/netease/a/a/g:e	()Ljava/lang/String;
    //   635: invokespecial 214	java/io/File:<init>	(Ljava/lang/String;)V
    //   638: invokestatic 239	com/netease/a/a/e:c	(Ljava/io/File;)V
    //   641: aload 20
    //   643: athrow
    //   644: invokestatic 358	com/netease/b/a/d:h	()Lcom/netease/b/a/d;
    //   647: invokevirtual 361	com/netease/b/a/d:a	()Landroid/content/Context;
    //   650: invokestatic 358	com/netease/b/a/d:h	()Lcom/netease/b/a/d;
    //   653: invokevirtual 452	com/netease/b/a/d:c	()Ljava/lang/String;
    //   656: aload 9
    //   658: aload 8
    //   660: invokestatic 485	com/netease/pris/c/i:a	(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Lcom/netease/a/a/g;)V
    //   663: goto -632 -> 31
    //   666: astore 17
    //   668: goto -72 -> 596
    //   671: astore 23
    //   673: goto -239 -> 434
    //   676: astore 21
    //   678: goto -52 -> 626
    //   681: astore 20
    //   683: aload 24
    //   685: astore 6
    //   687: goto -71 -> 616
    //   690: astore 22
    //   692: aload 24
    //   694: astore 6
    //   696: goto -277 -> 419
    //   699: aload 24
    //   701: astore 6
    //   703: goto -198 -> 505
    //
    // Exception table:
    //   from	to	target	type
    //   401	417	417	java/io/IOException
    //   457	477	417	java/io/IOException
    //   510	586	417	java/io/IOException
    //   401	417	614	finally
    //   419	424	614	finally
    //   457	477	614	finally
    //   510	586	614	finally
    //   591	596	666	java/io/IOException
    //   429	434	671	java/io/IOException
    //   621	626	676	java/io/IOException
    //   477	505	681	finally
    //   477	505	690	java/io/IOException
  }

  public static void a(String paramString)
  {
    com.netease.k.e locale = (com.netease.k.e)y.get(paramString);
    if (locale != null)
      locale.a(true);
  }

  private static void a(String paramString, int paramInt, long paramLong, com.netease.k.a parama)
  {
    com.netease.k.e locale = new com.netease.k.e(paramString, paramInt, false, paramLong, parama);
    y.put(paramString, locale);
  }

  private static void a(String paramString, int paramInt, com.netease.k.a parama)
  {
    com.netease.k.e locale = new com.netease.k.e(paramString, paramInt, true, 0L, parama);
    y.put(paramString, locale);
  }

  public static void a(String paramString, g paramg)
  {
    if ((paramg == null) || (paramString == null) || (paramg.e() == null))
      if (com.netease.pris.app.e.d)
        com.netease.g.b.e("CacheManagerEx", "***********not save cache url is:" + paramString);
    while (true)
    {
      return;
      File localFile = new File(paramg.e());
      if (!localFile.exists())
      {
        if (!com.netease.pris.app.e.d)
          continue;
        com.netease.g.b.e("CacheManagerEx", "***********not save cache url is:" + paramString);
        continue;
      }
      paramg.b(localFile.length());
      if ((paramg.d() == 0L) && (!paramg.m()))
        com.netease.g.b.e("CacheManagerEx", paramg.e() + " delete failed.");
      long l1 = System.currentTimeMillis();
      i.a(com.netease.b.a.d.h().a(), com.netease.b.a.d.h().c(), paramString, paramg);
      if (com.netease.pris.app.e.d)
      {
        com.netease.g.b.d("cache save ", "cache save > " + (System.currentTimeMillis() - l1));
        com.netease.g.b.c("CacheManagerEx", "saveCacheFile for url " + paramString);
      }
      paramg.n();
    }
  }

  private static void a(String paramString, g paramg, boolean paramBoolean)
  {
    if (com.netease.pris.app.e.d)
      com.netease.g.b.e("CacheManageEx", "setupFiles url is: " + paramString);
    long l1 = System.currentTimeMillis();
    if (!i())
      throw new d();
    if (com.netease.pris.app.e.d)
      com.netease.g.b.d("setup files", "setup file chechspace " + (System.currentTimeMillis() - l1));
    long l2 = System.currentTimeMillis();
    String str;
    if (paramBoolean)
      str = g();
    while (true)
    {
      File localFile1 = new File(str);
      if (!localFile1.exists())
        localFile1.mkdirs();
      if (com.netease.pris.app.e.d)
        com.netease.g.b.d("setup files", "setup file chechdir " + (System.currentTimeMillis() - l2));
      long l3 = System.currentTimeMillis();
      File localFile2 = new File(str, paramString);
      try
      {
        if (localFile2.exists())
          b(localFile2);
        while (true)
        {
          if (com.netease.pris.app.e.d)
          {
            com.netease.g.b.d("setup files", "setup file recreate " + (System.currentTimeMillis() - l3));
            System.currentTimeMillis();
          }
          paramg.a(str + File.separator + paramString);
          paramg.a(paramBoolean);
          return;
          str = f();
          break;
          if (com.netease.pris.app.e.d)
          {
            com.netease.g.b.d("setup files", "setup file delete " + (System.currentTimeMillis() - l3));
            l3 = System.currentTimeMillis();
          }
          localFile2.createNewFile();
        }
      }
      catch (IOException localIOException1)
      {
        while (true)
        {
          localIOException1.printStackTrace();
          a();
          try
          {
            localFile2.createNewFile();
          }
          catch (IOException localIOException2)
          {
            localIOException2.printStackTrace();
          }
        }
      }
    }
    throw new c();
  }

  public static boolean a(long paramLong)
  {
    return u.a(o(), paramLong);
  }

  public static boolean a(File paramFile)
  {
    boolean bool;
    if (paramFile.exists())
    {
      com.netease.k.e locale = (com.netease.k.e)y.get(paramFile.getParent());
      if (locale != null)
        bool = locale.b(paramFile);
    }
    while (true)
    {
      return bool;
      if (com.netease.pris.app.e.d)
        com.netease.g.b.b("cachemex", "deleteFile not find observer:" + paramFile.getParent());
      bool = paramFile.delete();
      continue;
      bool = false;
    }
  }

  public static boolean a(File paramFile1, File paramFile2)
  {
    boolean bool1;
    if (paramFile1.exists())
    {
      com.netease.k.e locale1 = (com.netease.k.e)y.get(paramFile1.getParent());
      if (locale1 != null)
      {
        boolean bool2 = locale1.a(paramFile1, paramFile2);
        if (bool2)
        {
          com.netease.k.e locale2 = (com.netease.k.e)y.get(paramFile2.getParent());
          if (locale2 != null)
            locale2.a(paramFile2);
        }
        bool1 = bool2;
      }
    }
    while (true)
    {
      return bool1;
      if (com.netease.pris.app.e.d)
        com.netease.g.b.b("cachemex", "renameFile not find observer:" + paramFile1.getParent());
      bool1 = paramFile1.renameTo(paramFile2);
      continue;
      bool1 = false;
    }
  }

  public static g b(String paramString, boolean paramBoolean)
  {
    return a(null, paramString, paramBoolean);
  }

  public static String b()
  {
    return u;
  }

  static String b(long paramLong)
  {
    Date localDate = new Date(paramLong);
    return n().format(localDate);
  }

  public static void b(File paramFile)
  {
    com.netease.k.e locale = (com.netease.k.e)y.get(paramFile.getParent());
    if (locale != null)
      locale.c(paramFile);
  }

  public static void b(String paramString)
  {
    com.netease.k.e locale = (com.netease.k.e)y.get(paramString);
    if (locale != null)
      locale.a(false);
  }

  public static String c()
  {
    return v;
  }

  public static void c(File paramFile)
  {
    if (paramFile.exists())
    {
      com.netease.k.e locale = (com.netease.k.e)y.get(paramFile.getParent());
      if (locale != null)
        locale.a(paramFile);
    }
  }

  public static void c(String paramString)
  {
    if (paramString != null)
    {
      com.netease.k.e locale1 = (com.netease.k.e)y.get(paramString);
      if (locale1 != null)
      {
        locale1.a(104857600L);
        locale1.a();
      }
      if (paramString.equals(w))
      {
        com.netease.k.e locale2 = (com.netease.k.e)y.get(x);
        if (locale2 != null)
        {
          locale2.a(104857600L);
          locale2.a();
        }
        com.netease.pris.b.a.a(104857600L);
      }
    }
  }

  public static g d(String paramString)
  {
    return b(paramString, false);
  }

  public static String d()
  {
    return w;
  }

  public static g e(String paramString)
  {
    return a(null, paramString, false, false);
  }

  public static String e()
  {
    return x;
  }

  public static g f(String paramString)
  {
    g localg = null;
    if (paramString == null);
    while (true)
    {
      return localg;
      localg = i.a(com.netease.b.a.d.h().a(), null, paramString);
    }
  }

  public static String f()
  {
    if (com.netease.pris.a.e.a());
    for (String str = u; ; str = v)
      return str;
  }

  public static String g()
  {
    if (com.netease.pris.a.e.a());
    for (String str = w; ; str = x)
      return str;
  }

  public static String h()
  {
    if (com.netease.pris.a.e.a());
    for (String str = Environment.getExternalStorageDirectory().toString() + "/" + "pris"; ; str = Environment.getDataDirectory() + "/data/" + "com.netease.pris")
      return str;
  }

  public static boolean i()
  {
    return u.a(o(), 3145728L);
  }

  private static DateFormat n()
  {
    if (t == null)
    {
      DateFormatSymbols localDateFormatSymbols = new DateFormatSymbols(Locale.ENGLISH);
      t = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss z");
      t.setDateFormatSymbols(localDateFormatSymbols);
    }
    return t;
  }

  private static String o()
  {
    if (com.netease.pris.a.e.a());
    for (String str = Environment.getExternalStorageDirectory().toString(); ; str = Environment.getDataDirectory() + "/data/")
      return str;
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.a.a.e
 * JD-Core Version:    0.6.0
 */